Skip to content

docs(express.json): clarify usage and add route-specific limit example #2037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from

Conversation

kushal4345
Copy link
Contributor

Summary

This PR updates the express.json() documentation to:

  • Clarify behavior and options in a more concise way.
  • Add an example showing how to set different limit values for specific routes (e.g., /upload).

Changes

  • Added a "Different limits for specific routes" section with a code example.
  • Maintained existing style and formatting consistent with the Express docs.
  • Verified that markdown tables and headings render correctly.

Reason

Issue #1421 requests additional clarity on using express.json() with different route limits.
This helps developers quickly understand how to override defaults for specific endpoints without affecting others.

Notes

  • No changes to Express codebase, only to documentation.
  • Follows current contributing and formatting guidelines.

@kushal4345 kushal4345 requested a review from a team as a code owner August 11, 2025 05:13
Copy link

netlify bot commented Aug 11, 2025

Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit 7940a18
🔍 Latest deploy log https://app.netlify.com/projects/expressjscom-preview/deploys/68a335a73b56d50008b4e159
😎 Deploy Preview https://deploy-preview-2037--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

github-actions bot commented Aug 11, 2025

🚦 Lighthouse Results (Mobile & Desktop)

URL Device Perf A11y Best Practices
/ mobile 🔴 50 🟢 100 🟢 96
/en/blog/posts.html mobile 🔴 72 🟢 96 🟢 96
/en/5x/api.html mobile 🔴 65 🟢 95 🟢 96
/ desktop 🟢 95 🟢 100 🟢 96
/en/blog/posts.html desktop 🟢 98 🟢 96 🟢 93
/en/5x/api.html desktop 🟢 92 🟢 95 🟢 96

@kushal4345 kushal4345 closed this Aug 11, 2025
@kushal4345 kushal4345 reopened this Aug 11, 2025
Copy link
Member

@ShubhamOulkar ShubhamOulkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think changes are required. Property table explained limit option very well and clear. See our use middleware page since this example explains how to use express.json() middleware.

@kushal4345
Copy link
Contributor Author

Thanks for the review!

I understand that the property table explains the limit option, but I think this example could still add value for developers. The table shows the option in isolation, while this example demonstrates how to apply different limits for specific routes (e.g., /upload) without affecting the global middleware.

In my experience, beginners often struggle to connect configuration options to real-world route usage, so I felt this would make the docs more practical and beginner-friendly.

Of course, I’m happy to adjust the wording or placement if you think a shorter version would fit better. Please let me know your thoughts!

@ShubhamOulkar
Copy link
Member

@kushal4345, I think updating use middleware page would be better. This page includes a built-in middleware section at the bottom.

@kushal4345
Copy link
Contributor Author

Thanks for the suggestion

i have Added a new section titled “Different Limits for Specific Routes” to the middleware page.
This section includes a clear code example demonstrating how to set different rate limits for individual routes.
The update aims to make the middleware page more informative and helpful for developers by providing practical usage guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants